from django.urls import path
from rest_framework.routers import DefaultRouter

from apps.meiduo_admin.login import admin_jwt_token
from apps.meiduo_admin.views import home, user, images, sku

urlpatterns = [
    path('authorizations/', admin_jwt_token),
    path('statistical/day_active/', home.UserDailyActiveCountView.as_view()),
    path('statistical/day_orders/', home.UserDailyOrderCountView.as_view()),
    path('statistical/day_increment/', home.UserDailyIncrementCountView.as_view()),
    path('statistical/total_count/', home.UserDailyTotalCountView.as_view()),
    path('statistical/month_increment/', home.UserDailyMonthIncrementCountView.as_view()),
    path('statistical/goods_day_views/', home.UserDailyGoodsDayView.as_view()),

    path('users/', user.UserListView.as_view()),

    path('skus/simple/', images.SKUInfoView.as_view()),

    path('skus/categories/', sku.GoodsCategoryListAPIView.as_view()),
    path('goods/simple/', sku.SPUListAPIView.as_view()),
    path('goods/<spu_id>/specs/', sku.SPUSpecificationAPIView.as_view()),
]

# 创建router实例
router = DefaultRouter()
# 注册路由
router.register(r'skus/images', images.SKUImagesView, basename='images')
router.register(r'skus', sku.SKUModelViewSet, basename='sku')
# 将router生成的路由追加到urlpatterns中
urlpatterns += router.urls
